﻿using System.Drawing;
using System.IO;
using EPiServer.ImageLibrary;
using NUnit.Framework;
using OpenWaves.ImageTransformations.EPiServer;

namespace OpenWaves.ImageTransformations.UnitTests.EPiServer
{
    [TestFixture]
    public class EPiImageTransformationServiceTests
    {
        [Test]
        public void Test()
        {
            var service = new EPiImageTransformationService(new ImageService());
            using (var output = new MemoryStream())
            {
                service.TransformImage(new MemoryStream(Resources.WhiteSquare_png), output, ImageFormat.Png, new ScaleToFillTransformation(500, 500));

                output.Seek(0, SeekOrigin.Begin);
                using (var img = Image.FromStream(output))
                {
                    Assert.That(img.Width, Is.EqualTo(500));
                    Assert.That(img.Height, Is.EqualTo(500));
                }
            }
        }
    }
}